import pymysql
conn = pymysql.connect(
    host='localhost',
    user='root',
    passwd='123456',
    db='db_library',
    port=3306,
    charset='utf8'
)
cur = conn.cursor()

# 创建表
# w = "CREATE table student(sid VARCHAR(10),sname VARCHAR(10),sage datetime,sgender VARCHAR(10),PRIMARY KEY(sid))"
# w = "create table Teacher(TId varchar(10),Tname varchar(10),PRIMARY key (Tid))"
# w = "create table Course(CId varchar(10),Cname nvarchar(10),TId varchar(10),PRIMARY KEY(CId))"
# w = "create table SC(skey int ,SId varchar(10),CId varchar(10),score decimal(18,1),PRIMARY key(skey))"




cur.execute(w)
ret = cur.fetchall()
print(ret)
conn.commit()
cur.close()
conn.close()